package com.sfac.modules.common.controller;

import com.sfac.modules.common.service.ImageService;
import com.sfac.modules.common.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.Resource;
import org.springframework.core.io.UrlResource;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.util.ResourceUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;



/**
 * @Author:唐琳的爹
 * @BelongsProject:hqyj_springboot
 * @BelongsPackage:com.sfac.modules.common.controller
 * @CreateTime:2022/8/23 10:51:35
 */
@RestController
@RequestMapping("/api")
public class ImageController {

    @Autowired
    private ImageService imageService;

    /**
     * 测试图片上传方法
     * @param file
     * @param imageTypeName
     * @return
     */
    @PostMapping(value = "/image/{imageTypeName}",consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
    public Result<String> uploadImage(@RequestParam MultipartFile file, @PathVariable String imageTypeName){
        return imageService.upLoadImage(file,imageTypeName);
    }



}
